<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vue入门指南——form表单绑定</title>
    <link rel="stylesheet" href="common.css">
    <script type="importmap">
        {
            "imports":{
                "vue" : "https://lib.baomitu.com/vue/latest/vue.esm-browser.js"
            }
        }
    </script>
</head>
<body>
    <div id="app">
        <p><input type="text" placeholder="输入文本" :value="text" @input="event=> text=event.target.value">
            <span>{{text}}</span></p>
        <p><input type="text" placeholder="单行文本" v-model="msg1">{{msg1}}</p>
        <p>
            <textarea name="" id="" cols="30" rows="10" placeholder="多行文本" v-model="msg2"></textarea>
        </p>
        <pre>{{msg2}}</pre>
        <p>
            <input type="checkbox" v-model="checked" id="cb1"><label for="cb1">{{checked}}</label>
        </p>
        <p>
            <span>选中项：{{checkedNames}}</span>
            <input type="checkbox" name="" id="one" value="选项1" v-model="checkedNames">
            <label for="one">选项1</label>
            <input type="checkbox" name="" id="two" value="选项2" v-model="checkedNames">
            <label for="two">选项2</label>
        </p>
        <p>
            <span>单选选中:{{picked}}</span>
            <input type="radio" id="r-one" value="One" v-model="picked">
            <label for="r-one">单选1</label>
            <input type="radio" id="r-two" value="Two" v-model="picked">
            <label for="r-two">单选2</label>
        </p>
        <p>
            <span>下拉列表选中:{{selected}}</span><br>
            <select name="" id="" v-model="selected">
                <option disabled value="">请选择</option>
                <option value="1">1</option>
                <option value="2">2</option>
                <option value="3">3</option>
            </select>
        </p>
        <p>
            <span>下拉列表(多选):{{mSelected}}</span><br>
            <select name="" id="" v-model="mSelected" multiple>
                <option>A</option>
                <option>B</option>
                <option>C</option>
            </select>
        </p>
    </div>
    <script type="module">
        import {createApp} from "vue";

        createApp({
            data(){
                return{
                    text:"",
                    msg1:"",
                    msg2:"",
                    checked:false,
                    checkedNames:[],
                    picked:"One",
                    selected:"",
                    mSelected:"",
                }
            }
        }).mount("#app");
        
    </script>
</body>
</html>